package mq.cinrad.kafka.app.config;

import java.util.List;

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;

public class KafkaWatchFileConfig {

	private String bootstrapServer;

	private String groupID;

	private String defaultTopic;

	private String fileActionCallbackName;

	private List<String> topicList;

	private List<String> dirList;

	private List<String> WildcardFileFilter;

	private List<String> notWildcardFileFilter;

	private List<String> prefixFileFilter;

	private List<String> notPrefixFileFilter;

	private List<String> suffixFileFilter;

	private List<String> notSuffixFileFilter;

	private BiMap<String, String> dirTopicBiMap = null;

	private String nameReplacement;

	private String nameRegex;

	public KafkaWatchFileConfig() {
		super();
	}

	public String getDefaultTopic() {
		return defaultTopic;
	}

	public void setDefaultTopic(String defaultTopic) {
		this.defaultTopic = defaultTopic;
	}

	public String getNameReplacement() {
		return nameReplacement;
	}

	public void setNameReplacement(String nameReplacement) {
		this.nameReplacement = nameReplacement;
	}

	public String getNameRegex() {
		return nameRegex;
	}

	public void setNameRegex(String nameRegex) {
		this.nameRegex = nameRegex;
	}

	public String getFileActionCallbackName() {
		return fileActionCallbackName;
	}

	public void setFileActionCallbackName(String fileActionCallbackName) {
		this.fileActionCallbackName = fileActionCallbackName;
	}

	public List<String> getWildcardFileFilter() {
		return WildcardFileFilter;
	}

	public void setWildcardFileFilter(List<String> wildcardFileFilter) {
		WildcardFileFilter = wildcardFileFilter;
	}

	public List<String> getNotWildcardFileFilter() {
		return notWildcardFileFilter;
	}

	public void setNotWildcardFileFilter(List<String> notWildcardFileFilter) {
		this.notWildcardFileFilter = notWildcardFileFilter;
	}

	public List<String> getPrefixFileFilter() {
		return prefixFileFilter;
	}

	public void setPrefixFileFilter(List<String> prefixFileFilter) {
		this.prefixFileFilter = prefixFileFilter;
	}

	public List<String> getNotPrefixFileFilter() {
		return notPrefixFileFilter;
	}

	public void setNotPrefixFileFilter(List<String> notPrefixFileFilter) {
		this.notPrefixFileFilter = notPrefixFileFilter;
	}

	public List<String> getSuffixFileFilter() {
		return suffixFileFilter;
	}

	public void setSuffixFileFilter(List<String> suffixFileFilter) {
		this.suffixFileFilter = suffixFileFilter;
	}

	public List<String> getNotSuffixFileFilter() {
		return notSuffixFileFilter;
	}

	public void setNotSuffixFileFilter(List<String> notSuffixFileFilter) {
		this.notSuffixFileFilter = notSuffixFileFilter;
	}

	public String getBootstrapServer() {
		return bootstrapServer;
	}

	public void setBootstrapServer(String bootstrapServer) {
		this.bootstrapServer = bootstrapServer;
	}

	public List<String> getTopicList() {
		return topicList;
	}

	public void setTopicList(List<String> topicList) {
		this.topicList = topicList;
	}

	public List<String> getDirList() {
		return dirList;
	}

	public void setDirList(List<String> dirList) {
		this.dirList = dirList;
	}

	public BiMap<String, String> getDirTopicBiMap() {
		if (dirTopicBiMap == null) {
			dirTopicBiMap = HashBiMap.create();
			if (null != topicList && null != dirList && topicList.size() == dirList.size()) {
				for (int i = 0; i < dirList.size(); i++) {
					dirTopicBiMap.put(dirList.get(i), topicList.get(i));
				}
			}
		}
		return dirTopicBiMap;
	}

	public String getGroupID() {
		return groupID;
	}

	public void setGroupID(String groupID) {
		this.groupID = groupID;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("KafkaWatchFileConfig [bootstrapServer=");
		builder.append(bootstrapServer);
		builder.append(", groupID=");
		builder.append(groupID);
		builder.append(", defaultTopic=");
		builder.append(defaultTopic);
		builder.append(", fileActionCallbackName=");
		builder.append(fileActionCallbackName);
		builder.append(", topicList=");
		builder.append(topicList);
		builder.append(", dirList=");
		builder.append(dirList);
		builder.append(", WildcardFileFilter=");
		builder.append(WildcardFileFilter);
		builder.append(", notWildcardFileFilter=");
		builder.append(notWildcardFileFilter);
		builder.append(", prefixFileFilter=");
		builder.append(prefixFileFilter);
		builder.append(", notPrefixFileFilter=");
		builder.append(notPrefixFileFilter);
		builder.append(", suffixFileFilter=");
		builder.append(suffixFileFilter);
		builder.append(", notSuffixFileFilter=");
		builder.append(notSuffixFileFilter);
		builder.append(", nameReplacement=");
		builder.append(nameReplacement);
		builder.append(", nameRegex=");
		builder.append(nameRegex);
		builder.append("]");
		return builder.toString();
	}

}
